interface Product {
   name: string;
   price: number;
}

interface Person {
   name: string;

   // 这是一个可选属性
   age?: number;

   // hours是必选参数
   sleep: (hours: number) => void;

   // food是可选参数
   eat: (food?: string) => void;
   work: () => Product;
}

let p: Person;
p = {
   name: "张三疯",
   // 可选属性可以实现，也可以不实现
   // age: 60,
   sleep: (hours: number) => {},
   eat: (food?: string) => {},
   work: () => {
      return {
         name: "太极剑谱",
         price: 0.5,
      };
   },
};
